package com.rran.study.designpattern.behavioral.observer.listener.spring;

import com.rran.study.designpattern.behavioral.observer.event.spring.RranEvent;
import com.rran.study.designpattern.behavioral.observer.model.Rran;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

/**
 * @author yy
 * @Type RranListener.java
 * @Desc
 * @date 2020/7/21 20:46
 */
@Service
public class RranListener2 {

    @EventListener
//    @Async
    public void onApplicationEvent(RranEvent rranEvent) {
        Rran rran = rranEvent.getSource();
        rran.setName("rran2");
        rran.setAge(19);
        System.out.println(rran);
        System.out.println("rran2 事件监听成功");

    }
}
